package com.zidongxiangxi.rabbit.producer.transaction.support;

import com.zidongxiangxi.rabbit.producer.entity.RabbitMessageInfo;

import java.util.LinkedList;
import java.util.List;

/**
 * 事务消息的暂存
 *
 * @author chenxudong
 * @date 2020/11/07
 */
public class RabbitMessageTransactionHolder {
	/**
	 * mq消息列表
	 */
	private final List<RabbitMessageInfo> queue = new LinkedList<>();
	/**
	 * mq是否提交
	 */
	private boolean committed = false;

	public void add(RabbitMessageInfo sendInfo) {
		queue.add(sendInfo);
	}

	public List<RabbitMessageInfo> getQueue() {
		return queue;
	}

	public boolean isCommitted() {
		return this.committed;
	}

	public void commit() {
		this.committed = true;
	}
}
